<template>
  <div class="login_style">
    <div class="user">
      <div>用户名：</div>
      <div class="">
        <input type="text" v-model="userName" />
      </div>
      <div>密码：</div>
      <div>
        <input type="text" v-model="password" />
      </div>
      <div>确认密码：</div>
      <div>
        <input type="text" v-model="passwordConfirm" />
      </div>
    </div>
    <div class="button">
      <button @click="goRegist" class="button_login">注册</button>
      <!-- <button @click="goRegist" class="button_reg">注册</button> -->
    </div>
    <div @click="goLogin">点我登陆</div>
  </div>
</template>

<script>
import { regist } from "../api/login";
export default {
  data() {
    return {
      userName: "",
      password: "",
      passwordConfirm: "",
    };
  },

  methods: {
    goRegist() {
      if (this.password != this.passwordConfirm) {
        alert("密码错误");
      } else {
        // this.$router.push("/index");
        // let { name, password } = this.ruleForm;
        let data = {
          userName: this.userName,
          password: this.password,
        };
        regist(data).then((res) => {
          if (res.data.status == 0) {
            if (res.data.data) {
              this.$router.push("/login");
            } else {
              alert("密码错误");
            }
          } else {
            alert("密码错误");
          }
        });
      }
    },
    goLogin() {
      this.$router.push("/login");
    },
  },
  mounted() {},
};
</script>
<style lang='scss' scoped>
.login_style {
  height: 100%;
  color: #666666;
  display: flex;
  font-size: 16px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  -webkit-tap-highlight-color: transparent;
  background: radial-gradient(
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.15) 30%,
        rgba(255, 255, 255, 0.3) 32%,
        rgba(255, 255, 255, 0) 33%
      )
      0 0,
    radial-gradient(
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.1) 11%,
        rgba(255, 255, 255, 0.3) 13%,
        rgba(255, 255, 255, 0) 14%
      )
      0 0,
    radial-gradient(
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 17%,
        rgba(241, 237, 237, 0.43) 19%,
        rgba(255, 255, 255, 0) 20%
      )
      0 110px,
    radial-gradient(
        rgba(235, 229, 229, 0) 0,
        rgba(255, 255, 255, 0.2) 11%,
        rgba(255, 255, 255, 0.4) 13%,
        rgba(255, 255, 255, 0) 14%
      ) -130px -170px,
    radial-gradient(
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.2) 11%,
        rgba(255, 255, 255, 0.4) 13%,
        rgba(255, 255, 255, 0) 14%
      )
      130px 370px,
    radial-gradient(
        rgba(255, 255, 255, 0) 0,
        rgba(255, 255, 255, 0.1) 11%,
        rgba(255, 255, 255, 0.2) 13%,
        rgba(250, 237, 237, 0) 14%
      )
      0 0,
    linear-gradient(
      45deg,
      #e9e9e7 0%,
      #ecf0ea 20%,
      #e7e7e9 50%,
      #f6f1f8 60%,
      #eeebed 70%,
      #f5eff1 80%,
      #ece2de 90%,
      #f3efeb 100%
    );
  background-size: 470px 470px, 970px 970px, 410px 410px, 610px 610px,
    530px 530px, 730px 730px, 100% 100%;
  background-color: #f7f0f2;

  .user {
    width: 60%;
    display: flex;
    flex-direction: column;
    input {
      width: 100%;
      height: 30px;
      border: #ebebeb 1px solid;
      border-radius: 6px;
      margin: 8px 0px;
    }
  }
  .button {
    margin: 20px;
    .button_login {
      margin-right: 10px;
      width: 300px;
      height: 40px;
      margin: 30px 10px 0px 10px;
      border-radius: 40px;
      border: #999999 1px solid;
      color: #000;
    }
    .button_reg {
      margin-left: 10px;
    }
  }
}
</style>